# Maintainer: Konstantin Gizdov <arch at kge dot pw>
# Contributor: Astro Benzene <universebenzene at sina dot com>
_pkgname='pytest-mpl'
pkgname="python-${_pkgname}"
pkgver=0.16.1
pkgrel=2
pkgdesc="Pytest plugin to help with testing figures output from Matplotlib"
arch=('any')
url="https://github.com/matplotlib/pytest-mpl"
license=('BSD')
depends=('python-pytest' 'python-matplotlib' 'python-jinja' 'python-packaging')
makedepends=('python-setuptools-scm' 'python-build' 'python-installer' 'python-wheel' 'git')
checkdepends=('python-pytest-cov' 'python-pytest-shutil' 'python-jinja')
source=("${pkgname}::git+https://github.com/matplotlib/pytest-mpl.git#tag=v${pkgver}")
sha256sums=('SKIP')

build() {
    cd "${srcdir}/${pkgname}"
    python -m build --wheel --no-isolation
}

check() {
    cd "${srcdir}/${pkgname}"
    # some tests fail
    PYTHONPATH="${srcdir}/${pkgname}/build/lib" pytest || echo 'some tests fail'
}

package() {
    cd "${srcdir}/${pkgname}"
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -D -m644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
    install -D -m644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
}
